package com.leoman.dao;

import com.leoman.entity.Type;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by 涂奕恒 on 2014/12/4 16:16.
 */
public interface TypeDao extends JpaRepository<Type, Integer> {

    @Query("select a from Type a where a.isCut = 0")
    List<Type> findList();

    @Query("select a from Type a where a.isCut = 0")
    Page<Type> findList(Pageable pageable);

    @Query("SELECT a FROM Type a WHERE a.isCut = 0 AND a.name = ?1 order by a.id desc")
    List<Type> findListByName(String name);
}